   <div class="main layui-clear">
    <div class="wrap">
        <div class="content detail">
            <div class="fly-panel detail-box">
                <h1>
                    <?php echo $question['title']; ?>
                </h1>
                <div class="fly-tip fly-detail-hint">
                    <span class="fly-tip-stick">
                        <?php echo $question['status'] ?>
                    </span>
                    <div class="jie-admin-box" data-id="<?php echo $question['id'] ?>">
                    </div>
                    <div class="fly-list-hint">
                        <a href="#comment">
                            <i class="iconfont" title="回答">
                                
                            </i>
                            <?php echo $question['answer_num'] ?>
                        </a>
                        <i class="iconfont" title="人气">
                            
                        </i>
                       <?php echo $question['view_num'] ?>
                    </div>
                </div>
                <div class="detail-about">
                    <a class="jie-user" href="{:U('home/u/main',array('id'=>$question['uid']))} ">
                        <img src="__ROOT__/<?php echo $question['face'] ?>"
                        alt="<?php echo $question['nickname']; ?>">
                        <cite>
                            <?php echo $question['nickname']; ?>
                            <em>
                                发布于<?php echo CT($question['create_time'])  ?>
                            </em>
                        </cite>
                    </a>
                    <div class="detail-hits" id="LAY_jieAdmin" data-id="8745">
                        <span style="color:#FF7200">
                            悬赏：<?php echo $question['kiss_num']; ?>飞吻
                        </span>
                        <?php if($store==2){ ?>
                        <span class="layui-btn layui-btn-mini jie-admin xbs-sou" qid='<?php echo $question['id'] ?>' type="collect" data-type="add">
                            收藏
                        </span>
                        <?php }else{  ?>
                         <span class="layui-btn layui-btn-mini jie-admin xbs-sou" qid='<?php echo $question['id'] ?>' type="collect" data-type="add">
                            取消收藏
                        </span>

                        <?php } ?>
                    </div>
                </div>
                <div class="detail-body photos">
                   <?php echo htmlspecialchars_decode($question['content']);  ?>
                 </div>   
            </div>
            <div class="fly-panel detail-box" style="padding-top: 0;">
                <ul class="jieda photos" id="jieda"> 
                   <?php if(empty($answers)){ ?>
                        <li class="fly-none">
                            没有任何回答
                        </li>
                    <?php }else{ ?> 

                        <?php foreach ($answers as  $row) { ?>

                            <li data-id="30429">
                                <a name="item-1491000319505">
                                </a>
                                <div class="detail-about detail-about-reply">
                                  <a class="jie-user" href="{:U('home/u/main',array('id'=>$row['uid']))}">
                                        <img src="__ROOT__/<?php echo $row['face'] ?>"
                                        alt="<?php echo $row['nickname'] ?>" layer-index="2">
                                        <cite>
                                            <i>
                                                <?php echo $row['nickname'] ?>
                                            </i>
                                        </cite>
                                    </a>
                                    <div class="detail-hits">
                                        <span>
                                            <?php echo CT($row['create_time']) ?>
                                        </span>
                                    </div>
                                   <?php if ($question['status']=='已采纳') { ?>
                                   <i class="iconfont icon-caina" title="最佳答案"></i>
                                   <?php } ?>
                                </div>
                                <div class="detail-body jieda-body">
                                    <?php echo xbsg(htmlspecialchars_decode($row['content'])); ?>
                                </div>
                                <div class="jieda-reply">

                                <?php  if(in_array($row['create_time'],$time)) { ?>
                                   <span class="jieda-zan zanok" type="zan">
                                <?php  }else{ ?>
                                    <span class="jieda-zan " type="zan">
                                    <?php } ?>
                                        <i class="iconfont icon-zan xbs-zan" answer-id='<?php echo $row['uid'] ?>' qid=<?php echo $row['qid'] ?> create-time=<?php echo $row['create_time'] ?> >
                                        
                                        </i>                          <em>
                                           <?php echo $row['zan_num'] ?>
                                        </em>
                                    </span>
                                    <span class="rop"  type="reply" nickname=<?php echo $row['nickname']; ?>>
                                        <i class="iconfont icon-svgmoban53">
                                        </i>
                                        回复
                                    </span>
                                  <?php if($question['nickname']==$_SESSION['nickname'] and $row['nickname']!=$_SESSION['nickname']){ ?>
                                        <div class="jieda-admin">
                                      <?php if ($question['status']=='未结贴') { ?>
                                        <span class="jieda-accept caina" type="accept" aqid=<?php echo $question['id']; ?>  auid=<?php echo $row['uid'];  ?> >
                                            采纳
                                        </span>
                                     <?php } ?>
                                        
                                    </div>
                                  <?php } ?>
                                  
                                </div>
                            </li>
                        <?php } ?>

                    <?php } ?>
                </ul>
                <div class="layui-form layui-form-pane">
                    <form action="" method="post">
                        <div class="layui-form-item layui-form-text">
                            <a name="comment">
                            </a>
                            <div class="layui-input-block">
                                <div class="layui-unselect fly-edit">
                                </div>
                                <textarea id="L_content" name="content" 
                                placeholder="我要回答" class="layui-textarea fly-editor" style="height: 150px;"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <input type="hidden" name="qid" value="<?php echo $question['id'] ?>">
                            <button class="layui-btn" lay-filter="reply" lay-submit="">
                                提交回答
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="edge">
        <dl class="fly-panel fly-list-one">
            <dt class="fly-panel-title">
                最近热帖
            </dt>
            <?php foreach ($hotView as  $row) { ?>
                <dd>
                    <a href="{:U('home/jie/index',array('id'=>$row['id']))}">
                        <?php echo $row['title'] ?>
                    </a>
                    <span>
                        <i class="iconfont">
                            
                        </i>
                        <?php echo $row['view_num'] ?>
                    </span>
                </dd>
            <?php } ?>
        </dl>
        <dl class="fly-panel fly-list-one">
            <dt class="fly-panel-title">
                最近热议
            </dt>
            <?php foreach ($hotAnsewr as  $row) { ?>
                <dd>
                    <a href="{:U('home/jie/index',array('id'=>$row['id']))}">
                        <?php echo $row['title'] ?>
                    </a>
                    <span>
                        <i class="iconfont"></i>
                        <?php echo $row['answer_num']; ?>
                    </span>
                </dd>
            <?php } ?>
        </dl>
    </div>
</div>



<script type="text/javascript"> 
    layui.use(['form','jquery','layedit'], function(){
            var form = layui.form();
            var layedit = layui.layedit;
            var layer=layui.layer;
            var $ = layui.jquery;
          
         
         // 收藏
         $('.xbs-sou').click(function(data) {
            qid=$(this).attr('qid');
            obj=$(this);
            $.ajax({
                url: '{:U('home/jie/coll')}',
                type: 'post',
                dataType: 'json',
                data: {qid: qid},
            })
            .done(function(respones) {
              if (respones.error==1) {
                layer.msg(respones.info,{icon:5});

              }else if(respones.error==2){
                layer.msg(respones.info,{icon:5});
                obj.html('取消收藏');
                obj.addClass('layui-btn-danger');

              }else if(respones.error==3){
                 layer.msg(respones.info,{icon:5});
                obj.html('收藏');
                obj.removeClass('layui-btn-danger');
              };
            })
            .fail(function() {
                alert(777);
            })
            
         });

          // 采纳
         $('.caina').click(function(data) {
           aqid=$(this).attr('aqid');
           auid=$(this).attr('auid');
           obj=$(this).parent();
            layer.confirm('确认采纳', {
              btn: ['确定','取消'] //按钮
            }, function(){             
              $.ajax({
                url: '{:U('home/jie/ajaxcaina')}',
                type: 'post',
                dataType: 'json',
                data: {'qid' :aqid },
              })
              .done(function(respones) {
                 if (respones.error==1) {
                   obj.html('');//删除采纳标签
                 layer.msg(respones.info, function(){
                     location.reload();
                 });
                };
              })
              .fail(function() {
                // alert(777);
                console.log("error");
              })
            })
         })
         
         
        // 点赞
          $('.xbs-zan').click(function(data) {
               qid=$(this).attr('qid');
               answer_id=$(this).attr('answer-id');
               create_time=$(this).attr('create-time');
               obj=$(this).parent();
               
            $.ajax({
                url: '{:U('home/jie/approve')}',
                type: 'post',
                dataType: 'json',
                data: {qid: qid,
                      answer_id : answer_id,
                       create_time:create_time}
            })
            .done(function(respones){
               if (respones.error=='1') {

                   layer.msg(respones.info,{icon:5});
               }else if (respones.error=='2') {
                 //去赞成功，删除样式
                layer.msg(respones.info,{icon:5});
                 obj.removeClass('zanok');

               }else if (respones.error=='3'){
                //点赞成功，增加样式
                layer.msg(respones.info,{icon:5});
                obj.addClass('zanok');

               };
            })
            .fail(function() {
                alert(777);
            })  
          });

            
         //编辑器
            layedit.set({
              uploadImage: {
                url: '{:U('home/jie/uploadImage')}' //接口url
                ,type: '' //默认post
              }
            });
            var index = layedit.build('L_content',{
                  height: 165
             });

        

     
           //监听提交
           form.on('submit(reply)', function(data){
                content = layedit.getContent(index);
                 data.field.content = content;
               $.ajax({
                   url:'{:U('home/jie/ajaxreply')}',
                   type: 'post',
                   dataType: 'json',
                   data: data.field,
               })
               
               .done(function(respones) {
                   if (respones.error==1){
                     layer.msg(respones.info, function(){});  
                   }else if (respones.error==2) {
                      layer.msg(respones.info, function(){});
                   }else{
                    layer.alert(respones.info, {icon: 6},function () {
                            location.reload();
                        });
                   };
               })
               .fail(function() {
                  alert(555);
               })
               return false;
              });

           // 二层回复
            $('.rop').click(function(event) {
              obj=$(this);
              nickname=obj.attr('nickname');
              str='@'+nickname+'@';
             content=layedit.getContent(index);
              if (content.indexOf(str)=='-1' ){
                str=content+str;
                layedit.setContent(index,str);
                layedit.xbsfocus(index);
              };             
            });
    });


       
         </script>
